package com.xiashitech.agent.instrumentation.dubbo.common.inst;

//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

import java.io.Serializable;

public class HaierResponse<T> implements Serializable {
    private static final long serialVersionUID = 6138979130005367537L;
    private boolean success;
    private T result;
    private String error;

    public HaierResponse() {
    }

    public void setResult(T result) {
        this.success = true;
        this.result = result;
    }

    public void setError(String error) {
        this.success = false;
        this.error = error;
    }

    public static <T> HaierResponse<T> ok(T data) {
        HaierResponse<T> resp = new HaierResponse();
        resp.setResult(data);
        return resp;
    }

    public static <T> HaierResponse<T> ok() {
        return (HaierResponse<T>) ok((Object)null);
    }

    public static <T> HaierResponse<T> fail(String error) {
        HaierResponse<T> resp = new HaierResponse();
        resp.setError(error);
        return resp;
    }

    public String toString() {
        return "Response(success=" + this.isSuccess() + ", result=" + this.getResult() + ", error=" + this.getError() + ")";
    }

    public boolean isSuccess() {
        return this.success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public T getResult() {
        return this.result;
    }

    public String getError() {
        return this.error;
    }
}
